package com.hnhegui.backend.platform.service.order;

import com.hnhegui.backend.entity.Result;
import com.hnhegui.backend.order.api.FulfillmentRestApi;
import com.hnhegui.backend.order.dto.response.FulfillmentResponseDTO;
import com.hnhegui.backend.platform.convert.order.FulfillmentConvert;
import com.hnhegui.backend.platform.vo.order.request.FulfillmentRequestVO;
import com.hnhegui.backend.platform.vo.order.response.FulfillmentResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 刘大海
 * @since 2025/10/27 11:04
 */
@Service
public class RestFulfillmentService {

    @Autowired
    FulfillmentRestApi fulfillmentRestApi;

    public FulfillmentResponseVO processFulfillment(FulfillmentRequestVO request) {
        Result<FulfillmentResponseDTO> fulfillmentResponseDTOResult =
            fulfillmentRestApi.processFulfillment(FulfillmentConvert.INSTANCE.convertRequest(request));
        return FulfillmentConvert.INSTANCE.convertResponse(fulfillmentResponseDTOResult.getData());
    }

}
